In this script, there is conducted the estimation for the measure_marginal approach for a single given env.

The env = geth, the programs file =pg_marginal_full5_c50_step5_shuffle.csv, the resutls file = results_geth_marginal_full5_c50_step5.csv.

Switch removed_outliers to FALSE to see the comparison.

if (!removed_outliers) {
  boxplot(measurements[which(measurements$env == env), 'measure_total_time_ns'] ~ measurements[which(measurements$env == env), 'opcode'], las=2, outline=TRUE, log='y', main=paste(env, 'all'))
}
if (removed_outliers) {
  measurements = remove_compare_outliers(measurements, 'measure_total_time_ns', c(env))
}

Every sample starts with a fresh evm instance. We investigate whether the results may depend on the time from evm start - related to run_id. To avoid being overrun by the number of images, all op_count for a given run_id are are placed, so values are not centered. That should not be an issue.

Now we can investigate the linear regressions.

for (opcode in all_opcodes) {
  estimate = compute_all(opcode=opcode, env=env, use_median=TRUE, plots=ifelse(details,'all','scatter'))
  estimates[nrow(estimates) + 1, ] = c(opcode, estimate, env)
}

estimates
##                 op estimate_marginal_ns estimate_marginal_ns_stderr  env
## 1              ADD           0.01818182                    5.884160 geth
## 2              MUL          19.48727273                   12.046293 geth
## 3              SUB          16.48090909                   11.903662 geth
## 4              DIV          13.86000000                   10.492908 geth
## 5             SDIV          10.26818182                   11.340349 geth
## 6              MOD           1.44545455                    6.905127 geth
## 7             SMOD           7.42000000                    7.200797 geth
## 8           ADDMOD          18.30909091                    7.035093 geth
## 9           MULMOD          18.91909091                    9.508636 geth
## 10             EXP          18.98272727                    8.474174 geth
## 11      SIGNEXTEND          11.63181818                    6.395028 geth
## 12              LT           5.28454545                    9.207749 geth
## 13              GT           3.33000000                    3.949999 geth
## 14             SLT          16.09000000                    9.684853 geth
## 15             SGT          20.80545455                    6.704062 geth
## 16              EQ           4.67181818                    4.352157 geth
## 17          ISZERO           8.28000000                    6.011885 geth
## 18             AND          10.63181818                    7.200858 geth
## 19              OR          13.01909091                   12.816152 geth
## 20             XOR          14.94181818                    7.518676 geth
## 21             NOT          10.33090909                    8.592447 geth
## 22            BYTE          -0.78545455                    5.962083 geth
## 23             SHL           0.66363636                    8.013460 geth
## 24             SHR          13.26727273                    9.132839 geth
## 25             SAR           7.60545455                    6.552844 geth
## 26         ADDRESS          -0.80272727                   10.071226 geth
## 27          ORIGIN           1.40272727                   10.541564 geth
## 28          CALLER          13.86909091                   11.598847 geth
## 29       CALLVALUE           6.56272727                   12.447075 geth
## 30    CALLDATALOAD         173.59272727                    9.109073 geth
## 31    CALLDATASIZE         -31.53000000                   10.009298 geth
## 32    CALLDATACOPY         237.99727273                    8.544039 geth
## 33        CODESIZE          38.31909091                   12.596797 geth
## 34        CODECOPY         152.84090909                    6.638269 geth
## 35        GASPRICE          -0.08636364                   13.495748 geth
## 36  RETURNDATASIZE          -9.03818182                   10.411407 geth
## 37  RETURNDATACOPY         180.59727273                   75.392463 geth
## 38        COINBASE          14.64272727                   14.491167 geth
## 39       TIMESTAMP         -17.37636364                   13.222286 geth
## 40          NUMBER           9.08818182                   15.243099 geth
## 41      DIFFICULTY          -1.44727273                   13.680486 geth
## 42        GASLIMIT          -8.59272727                   14.704691 geth
## 43         CHAINID          -6.63181818                   12.079269 geth
## 44     SELFBALANCE          85.20636364                   21.296603 geth
## 45             POP          -1.45090909                   10.054113 geth
## 46           MLOAD          70.29090909                   12.128445 geth
## 47          MSTORE         123.56000000                   14.937299 geth
## 48         MSTORE8          74.81363636                   13.361293 geth
## 49            JUMP          22.75818182                   28.990502 geth
## 50           JUMPI          17.77545455                   15.883931 geth
## 51              PC           7.75454545                    9.705817 geth
## 52           MSIZE           5.26090909                   15.145625 geth
## 53             GAS           2.65363636                   13.540866 geth
## 54        JUMPDEST          -2.72909091                   13.434212 geth
## 55           PUSH1          -3.44818182                   11.413646 geth
## 56           PUSH2          33.42454545                   10.120195 geth
## 57           PUSH3          12.93272727                   10.740547 geth
## 58           PUSH4          -5.74181818                    9.967251 geth
## 59           PUSH5           6.20636364                   14.513458 geth
## 60           PUSH6          13.99363636                   13.843363 geth
## 61           PUSH7          27.71909091                   11.911368 geth
## 62           PUSH8           1.18000000                   12.729979 geth
## 63           PUSH9          15.44181818                   14.091811 geth
## 64          PUSH10         -11.57909091                   14.065915 geth
## 65          PUSH11          15.05818182                   15.056288 geth
## 66          PUSH12         -10.44454545                   11.613648 geth
## 67          PUSH13          16.59909091                   12.256995 geth
## 68          PUSH14          17.37818182                   12.396334 geth
## 69          PUSH15          17.26363636                   13.797712 geth
## 70          PUSH16          21.59363636                   13.295536 geth
## 71          PUSH17           6.38818182                   13.430094 geth
## 72          PUSH18          20.68909091                   10.879376 geth
## 73          PUSH19          28.56454545                   12.878258 geth
## 74          PUSH20           4.51272727                   13.685034 geth
## 75          PUSH21          28.18272727                    9.612275 geth
## 76          PUSH22          16.16818182                   15.206091 geth
## 77          PUSH23           2.88090909                   13.238512 geth
## 78          PUSH24         -11.57090909                   11.424660 geth
## 79          PUSH25          -3.71363636                   12.392283 geth
## 80          PUSH26          17.13090909                   11.626804 geth
## 81          PUSH27           3.29818182                   13.222725 geth
## 82          PUSH28          -4.39181818                   13.105828 geth
## 83          PUSH29          -0.12818182                   10.660719 geth
## 84          PUSH30          -7.68636364                    7.734048 geth
## 85          PUSH31          21.17272727                   15.545703 geth
## 86          PUSH32          -5.73454545                   13.372705 geth
## 87            DUP1           5.13454545                    5.237731 geth
## 88            DUP2          -9.97909091                    8.264153 geth
## 89            DUP3          10.54545455                    9.467189 geth
## 90            DUP4           2.45363636                    4.163758 geth
## 91            DUP5          12.97727273                    8.381455 geth
## 92            DUP6          -2.17727273                    8.399040 geth
## 93            DUP7           3.82909091                    6.569730 geth
## 94            DUP8          17.85090909                    8.053795 geth
## 95            DUP9          12.74636364                    5.504442 geth
## 96           DUP10           1.07636364                   10.267983 geth
## 97           DUP11          -4.84545455                    9.132421 geth
## 98           DUP12          -4.37636364                    9.194029 geth
## 99           DUP13          14.80454545                    9.051736 geth
## 100          DUP14           4.79454545                    9.379667 geth
## 101          DUP15           1.67727273                    4.630857 geth
## 102          DUP16          18.99090909                    5.416721 geth
## 103          SWAP1          -7.45272727                    8.286846 geth
## 104          SWAP2           7.21545455                    6.121713 geth
## 105          SWAP3           5.85363636                    1.115540 geth
## 106          SWAP4           7.63818182                    4.757134 geth
## 107          SWAP5          16.42909091                   12.090059 geth
## 108          SWAP6          11.96272727                   11.364259 geth
## 109          SWAP7           4.76090909                   10.058601 geth
## 110          SWAP8          -1.90272727                    9.856910 geth
## 111          SWAP9          19.03363636                    8.277418 geth
## 112         SWAP10          33.12545455                   10.184164 geth
## 113         SWAP11           9.44636364                   12.453479 geth
## 114         SWAP12           0.98727273                    8.846178 geth
## 115         SWAP13           8.17909091                   10.051811 geth
## 116         SWAP14          11.73545455                   10.662654 geth
## 117         SWAP15         -13.18727273                   12.205502 geth
## 118         SWAP16          -4.29636364                   11.286868 geth
## 119          MCOPY          13.31090909                    3.477411 geth
## 120          PUSH0          -1.99636364                   14.096892 geth
## 121           SHA3         489.39090909                    5.155978 geth
## 122           LOG0         237.38818182                    4.642519 geth
## 123           LOG1         254.53454545                    3.850601 geth
## 124           LOG2         890.29000000                  359.711823 geth
## 125           LOG3        1573.84454545                  353.725190 geth
## 126           LOG4        1593.23363636                  299.261114 geth
## 127    EXTCODEHASH         104.64181818                    1.664547 geth
## 128    EXTCODESIZE          71.71272727                    1.396363 geth
## 129    EXTCODECOPY          83.01909091                    1.094443 geth
## 130         CREATE        5877.74636364                   15.688623 geth
## 131           CALL         527.99272727                    4.780306 geth
## 132     STATICCALL         458.55090909                    4.773682 geth
## 133   DELEGATECALL         404.20454545                    4.497061 geth
## 134         RETURN         138.45636364                    4.932743 geth
## 135         REVERT         955.15727273                   12.126875 geth
## 136           STOP           1.58818182                    4.950495 geth

The results are exported to ./geth_marginal_estimated_cost.csv.